package tech.aistar.mapper;

import org.apache.ibatis.annotations.*;
import tech.aistar.entity.Concern;

import java.util.List;

public interface ConcernMapper {
    @Select("select * from concern")
    List<Concern> selectAll();

    @Insert("insert into concern(tenant_id,house_id,concern_time) value(#{tenantId},#{houseId},#{concernTime})")
    void insert(Concern concern);

    @Update("update concern set tenant_id=#{tenantId},house_id=${houseId},concern_time=${concernTime} where id=#{Id}")
    void  updateByPrimaryKey(Concern concern);

    @Delete("delete from concern where id=#{Id}")
    void deleteByPrimaryKey(Integer id);

    @Select("select * from concern where tenant_id=#{tenant_id} and house_id=#{house_id}")
    Concern selectById(@Param("tenant_id") Integer tenantId, @Param("house_id") Integer houseId);

    @Delete("delete from concern where tenant_id=#{tenant_id} and house_id=#{house_id}")
    void deleteByDoubleId(@Param("tenant_id") Integer tenantId, @Param("house_id") Integer houseId);

    @Select("select * from concern where tenant_id=#{tenantId}")
    List<Concern> selectBytenantId(Integer tenantId);

    @Delete("delete from concern where id=#{Id}")
    int deleteById(Integer id);
}
